package com.whiteape.book.core.page;

import java.util.Objects;

public class PageStyleNew {
    private String fontColor;
    private String bgColor;
    private static PageStyleNew nightModePageStyle;

    public PageStyleNew(String bgColor, String fontColor) {
        this.bgColor = bgColor;
        this.fontColor = fontColor;
    }

    public static PageStyleNew getNightModePageStyle() {
        if (null == nightModePageStyle){
            nightModePageStyle = new PageStyleNew("#271F18", "#B6AEA7");
        }
        return nightModePageStyle;
    }

    public boolean isNight() {
        return fontColor.equals("#B6AEA7") && (bgColor.equals("#271F18"));
    }


    public String getFontColor() {
        return fontColor;
    }

    public void setFontColor(String fontColor) {
        this.fontColor = fontColor;
    }

    public String getBgColor() {
        return bgColor;
    }

    public void setBgColor(String bgColor) {
        this.bgColor = bgColor;
    }

    @Override
    public String toString() {
        return bgColor+";" + fontColor;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PageStyleNew that = (PageStyleNew) o;
        return Objects.equals(fontColor, that.fontColor) &&
                Objects.equals(bgColor, that.bgColor);
    }

    @Override
    public int hashCode() {
        return Objects.hash(fontColor, bgColor);
    }
}
